﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WS.EKA.FJYCM.Business;
using System.Configuration;
using WS.EKA.FJYCM.Business.DAL;
using WS.EKA.FJYCM.Business.Model;

namespace WS.EKA.FJYCM.WebUI.UserControls
{
    public partial class SystemEventsDetail : System.Web.UI.UserControl
    {
        public string SysName
        {
            get;
            set;
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitialData();
            }
        }

        private void InitialData()
        {
            if (!string.IsNullOrWhiteSpace(SysName))
            {
                var data = new List<Hpd_help_desk>();

                var deptNames = Config.DepartmentNames;

                foreach (string dept in deptNames)
                {
                    data.Add(new Hpd_help_desk() { Business_System = SysName, Department = dept });
                }

                hfSysName.Value = SysName;
                lblSysName.Text = lblSysName.ToolTip = SysName;
                lblTitle.Text = lblTitle.ToolTip = SysName;
                lblTotalCount.Text = data.Sum(x => x.EventCount).ToString();


                rptSysDept.DataSource = data;//SystemAccess.GetDeptmentOfSJ();
                rptSysDept.DataBind();
            }
        }
    }
}